home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / bbs / pad321.zip / STRIPSTR.MH < prev    next >
Text File  |  1996-08-21  |  787b  |  27 lines

  1. #ifndef __STRIPSTR_MH
  2. #define __STRIPSTR_MH
  3.  
  4. // stripStr removes all occourances of a number of characters from a string.
  5. // theString is the string being stripped, and stripStr contains the characters
  6. // to be removed from theString.
  7.  
  8. void stripStr (Ref string: theString, string: stripStr) {
  9.   int: sidx, tidx, stripidx, found;
  10.  
  11.   tidx := 1;
  12.   for (sidx := 1; sidx <= strlen (theString); sidx := sidx + 1) {
  13.     found := False;
  14.     for (stripidx := 1; stripidx <= strlen (stripStr); stripidx := stripidx + 1) {
  15.       if (theString [sidx] = stripStr [stripidx])
  16.         found := True;
  17.       };
  18.     if (found = False) {
  19.       theString [tidx] := theString [sidx];
  20.       tidx := tidx + 1;
  21.       };
  22.     };
  23.   theString := substr (theString,1,tidx-1);
  24.   }
  25.  
  26. #endif
  27.